<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
var white = "rgb(255, 255, 255)";
var green = "rgb(0, 255, 0)";
var yellow = "rgb(255, 255, 0)";
var red = "rgb(255, 0, 0)";

function onMouseDown() {
    if (!window.internals) {
        console.log('No internals');
        return;
    }

    shouldBe("getComputedStyle(window.document.body).backgroundColor", "white");

    vlink.offsetTop;
    shouldBe("internals.computedStyleIncludingVisitedInfo(vlink).color", "green");

    alink.offsetTop;
    shouldBe("internals.computedStyleIncludingVisitedInfo(alink).color", "yellow");

    link.offsetTop;
    shouldBe("internals.computedStyleIncludingVisitedInfo(link).color", "red");

    if (window.testRunner)
        testRunner.notifyDone();
}

function runTest() {
    if (!window.eventSender) {
        console.log('No event sender');
        return;
    }

    eventSender.mouseMoveTo(alink.offsetLeft + 5, alink.offsetTop + 5);
    eventSender.mouseDown();
}

if (window.testRunner)
    testRunner.waitUntilDone();
</script>
</head>
<body bgcolor="ffffff" link="ffzz" vlink="00ffx" alink="ffff0x" onload="runTest();">
This should have a white background.
<a href="" id="vlink">This text should be green.</a>
<a href="javascript:" id="alink" onmousedown="onMouseDown()">This text should be yellow while active.</a>
<a href="#" id="link" >This text should be red.</a>
</body>
</html>
